//
//  LikeInfoViewController.m
//  Four_Fit_New
//
//  Created by lanou on 16/7/20.
//  Copyright © 2016年 xmaz. All rights reserved.
//

#import "LikeInfoViewController.h"
#import "LikeUserCell.h"
#import <UIButton+WebCache.h>
#import "CommunityUserViewController.h"

@interface LikeInfoViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

static NSString *cellID = @"like_cell";
@implementation LikeInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"赞";

    [self.tableView registerNib:[UINib nibWithNibName:@"LikeUserCell" bundle:nil] forCellReuseIdentifier:cellID];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.urlArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    LikeUserCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
//    [cell.icon sd_setImageWithURL:[NSURL URLWithString:self.urlArray[indexPath.row]] forState:UIControlStateNormal];
    
    [cell.icon sd_setImageWithURL:[NSURL URLWithString:self.urlArray[indexPath.row]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"coolStart_female_n"]];
    
    cell.name.text = [NSString stringWithFormat:@"%@",self.nameArray[indexPath.row]];
    cell.declaration.text = [NSString stringWithFormat:@"%@",self.declarationArray[indexPath.row]];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 70;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    CommunityUserViewController *userVc = [[CommunityUserViewController alloc] init];
    userVc.userID = self.idArray[indexPath.row];
    userVc.userName = self.nameArray[indexPath.row];
    
    [self.navigationController pushViewController:userVc animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
